package net.huashitong.supervision.task.dao;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.utils.StringUtils;
import net.huashitong.supervision.task.entity.BriefCategory;
import net.huashitong.supervision.task.filter.BriefCategoryFilter;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/10/31
 * Time: 11:55
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Repository
public class BriefCategoryDao extends StringDao<BriefCategory> {

    public List<BriefCategory> queryFilter(BriefCategoryFilter filter) {
        GenericQuery query = createQuery("obj");
        if (StringUtils.isNotBlank(filter.getCategory())) {
            query.append(" and category like :category").setParam("category", StringUtils.getLikewords(filter.getCategory()));
        }
        return query.listResult(filter);
    }
}
